#include "device/exec_thread.h"

RC_STATUS CreateExecThread(ExecThread* thread)
{
    thread->taskQue = TaskListCreate(RC_TASK_LIST_SIZE);
    if (!context->tpool[i].taskQue) {
        return TASK_LIST_CREATE_FAILED;
    }
    thread->mutex = PTHREAD_MUTEX_INITIALIZER;
    thread->cond = PTHREAD_COND_INITIALIZER;
    int pc = pthread_create(&(thread->tid), NULL, TaskThreadLoop, thread);
    if (pc < 0) {
        TaskListDestroy(&(thread->taskQue));
        return PTHREAD_CREATE_FAILED;
    }
    return RC_SUCCESS;
}